package studentCourseSystem;

public class Student {
    private String studentId;
    private String name;
    private String gender;
    private Course selectedCourse;
    public Student(String studentId, String name, String gender) {
        this.studentId = studentId;
        this.name = name;
        this.gender = gender;
    }
    public void selectCourse(Course course) {
        this.selectedCourse = course;
        System.out.println(name + "（学生）成功选修课程：" + course.getCourseName());
    }
    public void dropCourse() {
        if (selectedCourse != null) {
            System.out.println(name + "（学生）退出课程：" + selectedCourse.getCourseName());
            this.selectedCourse = null;
        } else {
            System.out.println(name + "（学生）未选修任何课程，无法退课！");
        }
    }
    public void printTimetable() {
        if (selectedCourse != null) {
            Course course = selectedCourse;
            Teacher teacher = course.getTeacher();
            System.out.println("=== " + name + "的课表 ===");
            System.out.println("学生编号：" + studentId);
            System.out.println("课程名称：" + course.getCourseName());
            System.out.println("上课地点：" + course.getLocation());
            System.out.println("上课时间：" + course.getTime());
            System.out.println("授课教师：" + teacher.getName());
        } else {
            System.out.println(name + "（学生）未选修任何课程，课表为空！");
        }
    }
    public String getStudentId() { return studentId; }
    public void setStudentId(String studentId) { this.studentId = studentId; }

    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public String getGender() { return gender; }
    public void setGender(String gender) { this.gender = gender; }

    public Course getSelectedCourse() { return selectedCourse; }
}